package springboot.app.conf ;

import java.util.Properties ;


import org.springframework.context.annotation.Bean ;
import org.springframework.context.annotation.Configuration ;

import tk.mybatis.spring.mapper.MapperScannerConfigurer ;

/**
 * springboot继承mybatis通用mapper的配置
 * @author 80002165 @date 2017年7月1日 下午6:26:56
 */
@Configuration
public class MyBatisMapperScannerConfig {
    
    
    @Bean
    public MapperScannerConfigurer mapperScannerConfigurer() {
        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer() ;
        mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactoryBean") ;
        // dao层类扫描地址
        mapperScannerConfigurer.setBasePackage("springboot.app.dao") ;
        Properties properties = new Properties() ;
        properties.setProperty("mappers", "springboot.app.common.BaseDao") ;
        properties.setProperty("notEmpty", "false") ;
        properties.setProperty("IDENTITY", "MYSQL") ;
        mapperScannerConfigurer.setProperties(properties) ;
        return mapperScannerConfigurer ;
    }
}
